#region Copyright and License Notice
// Copyright (C)2010-2016 - Rob Levine and other contributors
// http://configgen.codeplex.com
// 
// This file is part of ConfigGen.
// 
// ConfigGen is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// ConfigGen is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License and 
// the GNU Lesser General Public License along with ConfigGen.  
// If not, see <http://www.gnu.org/licenses/>
#endregion

using System.Collections.Generic;
using System.Configuration;
using ConfigGen.Core.ConfigurationSettings;

namespace ConfigGen.Core
{
    /// <summary>
    /// Interface implemented by the <see cref="MachineConfigurationSettingCollectionFilter"/> class.
    /// </summary>
    public interface IMachineConfigurationSettingCollectionFilter
    {
        /// <summary>
        /// Filters the supplied list of machine configurations, according to the supplied settings.
        /// </summary>
        /// <remarks>
        /// <para>If <see cref="Preferences.LocalOnly"/> is specified in the supplied settings argument, then the list of machine configurations will be filtered to
        /// one that matches the current machine name, if it exists, otherwise the one for a machine with the name given by <see cref="MachineConfigurationSettingCollectionFilter.DefaultMachineName"/>. If this option is specified
        /// but neither condition is met, an exception is thrown.</para>
        /// <para>If <see cref="Preferences.LocalOnly"/> is not specified, the list is unfiltered.</para>
        /// </remarks>
        /// <param name="machineSettings">List of machine configuration settings (<see cref="MachineConfigurationSettings"/>) from the spreadsheet</param>
        /// <param name="settings">Configuration generation settings for current config gen "run".</param>
        /// <returns>Filtered list of <see cref="MachineConfigurationSettings"/>.</returns>
        /// <exception cref="ConfigurationErrorsException">Raised if <see cref="Preferences.LocalOnly"/> is specified but no entry found in supplied list
        /// for either the local machine's name, nor the default machine name.</exception>
        IList<MachineConfigurationSettings> Filter(
            IEnumerable<MachineConfigurationSettings> machineSettings,
            Preferences settings);
    }
}